﻿@model Sharp.Web.Models.EmployeeIndexModel
@using Ext.Net
@using Ext.Net.MVC
@using Sharp.Web
@{
    var x = Html.X();
}
@(
 x.GridPanel()
            .TopBar(x.Toolbar().Items(
x.Button().Icon(Icon.ApplicationForm).Text("浏览").OnClientClick("App.Grid.OnModuleOperation(this,'" + Url.Action("Details") + "');"),x.Button().Icon(Icon.Add).Text("新增").OnClientClick("App.Grid.OnModuleOperation(this,'" + Url.Action("Create") + "',{ShowOnly:true});"),x.Button().Icon(Icon.ApplicationFormEdit).Text("修改").OnClientClick("App.Grid.OnModuleOperation(this,'" + Url.Action("Edit") + "');"),x.Button().Icon(Icon.Delete).Text("删除").OnClientClick("App.Grid.OnModuleOperation(this,'" + Url.Action("Delete") + "',{IsAjax:true});")
                ,new ToolbarFill(),
                x.TextField().Width(300).FieldLabel("搜索").LabelWidth(50)
                    .Triggers(
                        x.FieldTrigger().Icon(TriggerIcon.Clear).HideTrigger(true),
                        x.FieldTrigger().Icon(TriggerIcon.Search)
                    )
                    .Listeners(ls => { ls.TriggerClick.Fn = "App.Grid.searchFieldTriggerClick"; })
                ))
            .Plugins(
                x.GridFilters()
                    .Local(false)
                    .Filters(
x.StringFilter().DataIndex(Model, d => d.Number),
x.StringFilter().DataIndex(Model, d => d.FullName),
x.StringFilter().DataIndex(Model, d => d.Jianpin),
x.StringFilter().DataIndex(Model, d => d.IdCard),
x.StringFilter().DataIndex(Model, d => d.Birthday),
x.StringFilter().DataIndex(Model, d => d.Phone),
x.StringFilter().DataIndex(Model, d => d.JobTitle),
x.StringFilter().DataIndex(Model, d => d.Fax),
x.StringFilter().DataIndex(Model, d => d.Email),
x.StringFilter().DataIndex(Model, d => d.Address),
x.StringFilter().DataIndex(Model, d => d.RegisteredResidence),
x.StringFilter().DataIndex(Model, d => d.WorkDate),
x.StringFilter().DataIndex(Model, d => d.UrgentContact),
x.StringFilter().DataIndex(Model, d => d.UrgentPhone),
x.StringFilter().DataIndex(Model, d => d.CheckInUserName),
x.StringFilter().DataIndex(Model, d => d.ModifiedUserName)
                    )
            )
            .Store(x.StoreForModel()
                .Proxy(x.AjaxProxy().Url(Url.Action("GetPaged")).Post().Reader(x.JsonReader().RootProperty("data")))
                .RemoteSort(true).RemotePaging(true).PageSize(25)
                .SorterFor(Model, m => m.Id, Ext.Net.SortDirection.DESC)
                )
            .SelectionModel(x.CheckboxSelectionModel())
            .ColumnModel(
x.RowNumbererColumn().Align(ColumnAlign.End).Width(60),
x.ColumnFor(m => m.Id),
x.ColumnFor(m => m.Number),
x.ColumnFor(m => m.FullName),
x.ColumnFor(m => m.Jianpin),
x.TemplateColumn().DataIndex("Gender").Text("性别").TemplateString("<tpl for=\".\">{Gender.Name}</tpl>"),
x.ColumnFor(m => m.Age),
x.TemplateColumn().DataIndex("Nation").Text("民族").TemplateString("<tpl for=\".\">{Nation.Name}</tpl>"),
x.ColumnFor(m => m.IdCard),
x.ColumnFor(m => m.Birthday),
x.ColumnFor(m => m.Phone),
x.TemplateColumn().DataIndex("Posttitle").Text("职称").TemplateString("<tpl for=\".\">{Posttitle.Name}</tpl>"),
x.ColumnFor(m => m.JobTitle),
x.ColumnFor(m => m.Fax),
x.ColumnFor(m => m.Email),
x.ColumnFor(m => m.Address),
x.ColumnFor(m => m.RegisteredResidence),
x.ColumnFor(m => m.WorkDate),
x.TemplateColumn().DataIndex("Married").Text("婚姻状况").TemplateString("<tpl for=\".\">{Married.Name}</tpl>"),
x.TemplateColumn().DataIndex("EducationalBackground").Text("学历").TemplateString("<tpl for=\".\">{EducationalBackground.Name}</tpl>"),
x.TemplateColumn().DataIndex("Degree").Text("学位").TemplateString("<tpl for=\".\">{Degree.Name}</tpl>"),
x.ColumnFor(m => m.UrgentContact),
x.ColumnFor(m => m.UrgentPhone),
x.TemplateColumn().DataIndex("PostState").Text("任职状况").TemplateString("<tpl for=\".\">{PostState.Name}</tpl>"),
x.ColumnFor(m => m.CheckInTime),
x.ColumnFor(m => m.CheckInUserName),
x.ColumnFor(m => m.ModifiTime),
x.ColumnFor(m => m.ModifiedUserName)
            )
            .BottomBar(x.PagingToolbar().ItemsFromPartial("~/Views/Shared/_PagingToolbarPartial.cshtml"))
            .EmptyText("无数据。")
            .View(x.GridView().StripeRows(true).TrackOver(true))            .Listeners(li => { li.ItemDblClick.Fn = "App.Grid.OnModuleGridItemDblClick"; })
)
